import static org.junit.Assert.*;

import org.junit.Test;

/**
 * 
 */

/**
 * @author Medrano
 *
 */
public class HeapPriorityQueueTest {

	/**
	 * Test method for {@link HeapPriorityQueue#offer(java.lang.Object)}.
	 */
	@Test
	public void testOffer() {
		HeapPriorityQueue<SymbolNode<String>> cola1 = new HeapPriorityQueue<SymbolNode<String>>(100);
		SymbolNode<String> nodo1 = new SymbolNode<String>("a",3);
		SymbolNode<String> nodo2 = new SymbolNode<String>("b",4);
		SymbolNode<String> nodo3 = new SymbolNode<String>("c",5);
		SymbolNode<String> nodo4 = new SymbolNode<String>("d",6);
		SymbolNode<String> nodo5 = new SymbolNode<String>("e",7);
		SymbolNode<String> nodo6 = new SymbolNode<String>("f",8);
		
		cola1.add(nodo2);
		cola1.add(nodo4);
		cola1.add(nodo6);
		cola1.add(nodo3);
		cola1.add(nodo1);
		cola1.add(nodo5);
		
		assertEquals(nodo1, cola1.remove());
	}

	/**
	 * Test method for {@link HeapPriorityQueue#remove()}.
	 */
	@Test
	public void testRemove() {
		
		HeapPriorityQueue<SymbolNode<String>> cola1 = new HeapPriorityQueue<SymbolNode<String>>(100);
		SymbolNode<String> nodo1 = new SymbolNode<String>("a",3);
		SymbolNode<String> nodo2 = new SymbolNode<String>("b",4);
		SymbolNode<String> nodo3 = new SymbolNode<String>("c",5);
		SymbolNode<String> nodo4 = new SymbolNode<String>("d",6);
		SymbolNode<String> nodo5 = new SymbolNode<String>("e",7);
		SymbolNode<String> nodo6 = new SymbolNode<String>("f",8);
		
		cola1.add(nodo2);
		cola1.add(nodo4);
		cola1.add(nodo6);
		cola1.add(nodo3);
		cola1.add(nodo1);
		cola1.add(nodo5);
		
		assertEquals("a",cola1.remove().getValue());
		
	}

	/**
	 * Test method for {@link HeapPriorityQueue#size()}.
	 */
	@Test
	public void testSize() {
		
		HeapPriorityQueue<SymbolNode<String>> cola1 = new HeapPriorityQueue<SymbolNode<String>>(100);
		SymbolNode<String> nodo1 = new SymbolNode<String>("a",3);
		SymbolNode<String> nodo2 = new SymbolNode<String>("b",4);
		SymbolNode<String> nodo3 = new SymbolNode<String>("c",5);
		SymbolNode<String> nodo4 = new SymbolNode<String>("d",6);
		SymbolNode<String> nodo5 = new SymbolNode<String>("e",7);
		SymbolNode<String> nodo6 = new SymbolNode<String>("f",8);
		
		cola1.add(nodo2);
		cola1.add(nodo4);
		cola1.add(nodo6);
		cola1.add(nodo3);
		cola1.add(nodo1);
		cola1.add(nodo5);
		
		assertEquals(6, cola1.size());
		
	}

}
